/*
 * MIT License
 *
 * Copyright (c) 2020 wen.gu <454727014@qq.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/***************************************************************************
* Name: mp_decoder.h
*
* Purpose: the decoder component for micro player
*
* Developer:
*   wen.gu , 2018-09-05
*
* TODO:
*
***************************************************************************/
#ifndef __MP_DECODER_H__
#define __MP_DECODER_H__

/******************************************************************************
**    INCLUDES
******************************************************************************/
#include "mp_media.h"
#include "mp_component.h"
#include "mp_buffer.h"

/******************************************************************************
**    MACROS
******************************************************************************/
#define MP_DECODER_COMP_TYPE "mp_decoder"
/******************************************************************************
**    TYPE DEFINITIONS
******************************************************************************/

struct MPDecoderCreateParam: public MPCCreateParam
{
    MPTrackInfo info;
    EXTEND_MPCCREATEPARAM(MPDecoderCreateParam, MP_DECODER_COMP_TYPE);
};
/******************************************************************************
**    CLASSES/FUNCTIONS DEFINITIONS
******************************************************************************/

class MPDecoder : public MPComponent
{
public:
    MPDecoder(const std::string& name, const std::string & version)
        :MPComponent(name, version)
    {
        /** todo something */
    }

    virtual ~MPDecoder()
    {
        /** todo something */
    }

public:
    virtual MPError reset() = 0; /** reset decoder state to new decode */
    virtual MPTrackInfo* getFormat() = 0; /**get decoder output information*/
    virtual MPError sendPacket(MPBuffer* pkt) = 0;
    virtual MPError receiveFrame(MPBuffer** frame) = 0;

};

#endif /** !__MP_DECODER_H__*/